Skip to content

fix(ipc): encode StandaloneDevice::registry_model_id as Option for bincode - #759

Open
rekcilyssup wants to merge 1 commit into
AprilNEA:masterfrom
rekcilyssup:fix/ipc-registry-model-id-bincode-571
Open

fix(ipc): encode StandaloneDevice::registry_model_id as Option for bincode#759
rekcilyssup wants to merge 1 commit into
AprilNEA:masterfrom
rekcilyssup:fix/ipc-registry-model-id-bincode-571

Conversation

@rekcilyssup

Copy link
Copy Markdown
Contributor

Summary

Fixes #571StandaloneDevice::registry_model_id used skip_serializing_if = "Option::is_none" which is safe for JSON but not for bincode (non-self-describing). When the field is None, the encoded AgentSnapshot is truncated and the GUI fails to decode every poll, losing the entire inventory while such a device is present.

Changes

  • crates/openlogi-core/src/device.rs:410: drop skip_serializing_if, keep #[serde(default)]
  • crates/openlogi-ipc/src/ipc.rs:55: bump PROTOCOL_VERSION 23 → 24 (append-only wire format rule)
  • crates/openlogi-ipc/tests/wire_format.rs:66: make assert_wire round-trip (deserialize + re-encode check) without requiring PartialEq on tarpc-generated types; pin version to 24 and regenerate registry_model_id = None golden (…6100 instead of …61)
  • crates/openlogi-agent/src/bin/mock_agent.rs:432: remove obsolete workaround comment (keeps Some("8c900") for asset lookup)

Testing

  • DEVELOPER_DIR=/Library/Developer/CommandLineTools cargo test -p openlogi-ipc --test wire_format — 13 passed (including round-trip)
  • cargo test -p openlogi-core -p openlogi-ipc -p openlogi-hid -p openlogi-agent-core — passed
  • cargo clippy -p openlogi-core -p openlogi-ipc -p openlogi-agent --all-targets -- -D warnings — clean
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay — clean
  • Manual verification: StandaloneDevice { registry_model_id: None } round-trips via bincode::DefaultOptions before/after; Some("8c900") golden unchanged

Fixes #571

…ncode

Drop skip_serializing_if from StandaloneDevice::registry_model_id.
bincode is not self-describing, so skipping None truncates the
stream and makes every AgentSnapshot undecodable while a device
without a registry model is present - the GUI then gets no inventory
at all. A plain Option already encodes its presence byte.

Bump PROTOCOL_VERSION to 24 and update the None golden. Make
assert_wire round-trip (decode and re-encode) so truncated streams
are caught, without requiring PartialEq on tarpc-generated types.

Fixes AprilNEA#571
@rekcilyssup
rekcilyssup requested a review from AprilNEA as a code owner August 21, 2026 13:59
@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes bincode serialization of an absent StandaloneDevice::registry_model_id and versions the resulting IPC wire-format change.

  • Always encodes the trailing optional registry model ID.
  • Bumps the IPC protocol version from 23 to 24.
  • Strengthens golden-wire tests with decode/re-encode validation.
  • Removes the obsolete mock-agent workaround explanation.

Confidence Score: 5/5

The PR appears safe to merge, with the serialization fix, protocol-version guard, and updated wire tests aligned.

The changed optional field remains appended, is now encoded consistently for bincode, and incompatible GUI and agent versions are rejected before snapshot decoding.

Important Files Changed

Filename Overview
crates/openlogi-core/src/device.rs Removes conditional omission of the trailing optional field so bincode emits an explicit None tag.
crates/openlogi-ipc/src/ipc.rs Correctly bumps and documents the protocol version for the changed positional wire encoding.
crates/openlogi-ipc/tests/wire_format.rs Updates the None golden bytes and adds deserialization plus canonical re-encoding checks to all pinned wire values.
crates/openlogi-agent/src/bin/mock_agent.rs Removes an obsolete workaround comment while retaining the real registry ID used for asset lookup.

Reviews (1): Last reviewed commit: "fix(ipc): encode StandaloneDevice::regis..." | Re-trigger Greptile

@davidbudnick davidbudnick added type: bug Something is broken or behaves incorrectly platform: all Cross-platform issue labels Aug 21, 2026
AprilNEA pushed a commit to rekcilyssup/OpenLogi that referenced this pull request Aug 23, 2026
…model_id bincode

Fixes AprilNEA#606 — Input Monitoring row read the GUI process's IOHIDCheckAccess
rather than the agent's, showing a grant that never affects HID discovery.
Add input_monitoring_granted to AgentStatus (append-only, bump
PROTOCOL_VERSION to 25), populate from openlogi_hid::permissions::has_access
via a new input_monitoring watcher and ObservableState setter, and read it
from AppState::agent_status in the Settings page.

Fixes AprilNEA#571 — StandaloneDevice::registry_model_id used
skip_serializing_if, truncating bincode when None and making every
AgentSnapshot undecodable. Drop the attribute, keep #[serde(default)],
regenerate the None golden and make assert_wire round-trip (decode +
re-encode) without requiring PartialEq on tarpc-generated types.

Depends on AprilNEA#759 (v24) — this stacks v25 on top; will rebase to keep
24+25 sequential once AprilNEA#759 lands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: all Cross-platform issue type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snapshot fails to decode when a standalone device has no registry_model_id

2 participants